package com.ruoyi.project.channel.goodsInfo.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.channel.goodsInfo.mapper.GoodsInfoMapper;
import com.ruoyi.project.channel.goodsInfo.domain.GoodsInfo;
import com.ruoyi.project.channel.goodsInfo.service.IGoodsInfoService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 商品 服务层实现
 * 
 * @author CAIN
 * @date 2021-01-17
 */
@Service
public class GoodsInfoServiceImpl implements IGoodsInfoService 
{
	@Autowired
	private GoodsInfoMapper goodsInfoMapper;

	/**
     * 查询商品信息
     * 
     * @param productId 商品ID
     * @return 商品信息
     */
    @Override
	public GoodsInfo selectGoodsInfoById(Long productId)
	{
	    return goodsInfoMapper.selectGoodsInfoById(productId);
	}
	
	/**
     * 查询商品列表
     * 
     * @param goodsInfo 商品信息
     * @return 商品集合
     */
	@Override
	public List<GoodsInfo> selectGoodsInfoList(GoodsInfo goodsInfo)
	{
	    return goodsInfoMapper.selectGoodsInfoList(goodsInfo);
	}
	
    /**
     * 新增商品
     * 
     * @param goodsInfo 商品信息
     * @return 结果
     */
	@Override
	public int insertGoodsInfo(GoodsInfo goodsInfo)
	{
	    return goodsInfoMapper.insertGoodsInfo(goodsInfo);
	}
	
	/**
     * 修改商品
     * 
     * @param goodsInfo 商品信息
     * @return 结果
     */
	@Override
	public int updateGoodsInfo(GoodsInfo goodsInfo)
	{
	    return goodsInfoMapper.updateGoodsInfo(goodsInfo);
	}

	/**
     * 删除商品对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteGoodsInfoByIds(String ids)
	{
		return goodsInfoMapper.deleteGoodsInfoByIds(Convert.toStrArray(ids));
	}
	
}
